<?php


$current_turn = '1';

echo "</br>Potential spouses</br>";

//\Doctrine\Common\Util\Debug::dump($data2);
//print_r($data2);
//echo "</br>";
//echo count($data2);
//echo "</br>";

//echo "</br>";

//echo $data2;

$counter1 = '1';

foreach ($data as $key => $row) {
    
    //echo $row -> monster();
    
    echo form_open('family/propose_union');
    //echo ($row->getName()) . ($row->getId());
    $name = $row -> getName();
    
    $which_family = $row -> getWhichFamily();
    $family = $this->doctrine->em->find('ORM\Dynasties2\Families', $which_family);
    //echo "You are logged in as the <b>" . $family->getFamilyName() . "</b> family.</br></br>";
    
    $born_turn = $row -> getBornDate();
    //$married_to = $row-> getMarriedTo();
    //$is_female = $row -> getIsFemale();
    
    $abs_diff = abs($current_turn - $born_turn);
    $char2_turns_old = $abs_diff;
    //echo $test_diff . " - " . $born_turn;
    $age = $abs_diff / 8;
    
    echo "   > " . $name . " " . $family->getFamilyName() . ", aged " . $age . " years, born on turn " . $born_turn . ".   ";
    
    echo form_hidden('char2id', $row -> getId());
    echo form_hidden('char2fam', $row -> getWhichFamily());
    
    
    

    echo form_dropdown('target_turn',$data2[$counter1]);
    $counter1++;
    
    echo form_submit('submit','Propose');
    echo form_close();
    
    
    echo "</br>";
}



echo form_open('family/index');
echo form_submit('submit','Back');
echo form_close();
